package Offer_05;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/3/30 11:12
 * 替换空格
 */
public class Solution {
    public String replaceSpace(String s) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == ' ') {
                sb.append("%20");
            } else {
                sb.append(s.charAt(i));
            }
        }
        return sb.toString();
    }
}
